package com.hj.system.system.filter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 显示客户端信息
 * a
 *
 * @author wxf
 */
public class RemoteIpFilter implements Filter {
    private static Logger logger = LoggerFactory.getLogger(RemoteIpFilter.class);


    @Override
    public void init(FilterConfig filterConfig) {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest) request;
        String addr = req.getRemoteAddr();
        String host = req.getRemoteHost();
        int port = req.getRemotePort();
        //logger.info(addr + "  " + host + "   " + port);
        filterChain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }


}
